package com.flyco.modules.oms.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.flyco.common.api.vo.Result;
import com.flyco.common.system.vo.LoginUser;
import com.flyco.modules.home.vo.OrderTotalPayAmountVO;
import com.flyco.modules.oms.entity.OmsOrderItem;
import com.flyco.modules.oms.entity.OmsOrderInvoice;
import com.flyco.modules.oms.entity.OmsOrder;
import com.baomidou.mybatisplus.extension.service.IService;
import com.flyco.modules.oms.vo.OmsOrderPage;
import com.flyco.modules.oms.vo.OmsSendOrderDto;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @Description: 订单管理
 * @Author: flyco
 * @Date: 2019-12-10
 * @Version: V1.0
 */
public interface IOmsOrderService extends IService<OmsOrder> {

    /**
     * 新增发货单
     */
    OmsOrder addSendOrder(OmsSendOrderDto sendOrderDto, LoginUser sysUser, Long applyId);

    Result payment(String orderId, LoginUser sysUser);

    OmsOrder addOmsOrder(OmsOrderPage omsOrderPage, Boolean needComputeAmount, Boolean needApprove);

    public String generateOrderSn();

    /**
     * 添加一对多
     */
    public void saveMain(OmsOrder omsOrder, List<OmsOrderItem> omsOrderItemList, List<OmsOrderInvoice> omsOrderInvoiceList);

    /**
     * 修改一对多
     */
    public void updateMain(OmsOrder omsOrder, List<OmsOrderItem> omsOrderItemList, List<OmsOrderInvoice> omsOrderInvoiceList);

    /**
     * 删除一对多
     */
    public void delMain(String id);

    /**
     * 批量删除一对多
     */
    public void delBatchMain(Collection<? extends Serializable> idList);

    public Map<String, Object> indexOrderInit();

    public List<Map<String, Object>> indexOrderBar();

    public List<Map<String, Object>> indexOrderMiniArea();

    public List<Map<String, Object>> indexOrderRank();

    public List<OrderTotalPayAmountVO> indexOrderTotalPayAmount(Date dayStart, Date dayEnd);

    public void confirmBatch(Collection<? extends Serializable> idList);

    public void innerConfirmBatch(Collection<? extends Serializable> idList);

    public void groupBuyConfirmBatch(Collection<? extends Serializable> idList);

    Page<OmsOrder> getLiveOrderPage(Page<OmsOrder> page, Wrapper<OmsOrder> wrapper);

    Page<OmsOrder> getInnerOrderPage(Page<OmsOrder> page, Wrapper<OmsOrder> wrapper);

    Page<OmsOrder> getGroupBuyOrderPage(Page<OmsOrder> page, Wrapper<OmsOrder> wrapper);

    void sendMailAfterApprove(String orderId);

    void batchSetOrderDivideSendFlag();

    void handleCancelJdSendOrder();

    void sendMsgAfterApprove(String orderId);

    Boolean clearWxJxCache();

    List<OmsOrder> getOrderList(Long storeId, LocalDateTime beginTime);

    List<OmsOrder> getOrderList(Long storeId);

    void sendPickupMsg();

    void sendOrderAuditMsg();

    void antiApprove(OmsOrder order);

    List<OmsOrder> getAuditOrderList(OmsOrder order);

    List<OmsOrder> getOrderListByStoreId(String storeId,String orderId);

    void updatePayOrderStatus() throws Exception;

    void updateOutStockStatusRedis() throws Exception;

}
